package com.shop.loan.model.vo;

import com.shop.loan.model.UserBank;
import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.Readonly;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.ReferenceTreeType;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.ManyToOne;

@Getter
@Setter
@Erupt(name = "UpdateBankVo")
public class UpdateBankVo extends BaseModel {


    @EruptField(
            edit = @Edit(
                    title = "用户id",
                    readonly = @Readonly,
                    show = false
            )
    )
    private Long userId;


    @EruptField(
            edit = @Edit(
                    title = "订单id",
                    readonly = @Readonly,
                    show = false
            )
    )
    private Long orderId;


    @ManyToOne
    @EruptField(
            views = @View(title = "银行卡", column = "carNo"),
            edit = @Edit(
                    title = "银行卡",
                    notNull = true,
                    type = EditType.REFERENCE_TREE,
                    referenceTreeType = @ReferenceTreeType(
                            label = "carNo",
                            dependField = "userId",
                            dependColumn = "user_id"
                    )
            )
    )
    private UserBank userBank;

}
